const fs = require("fs");

var str = "";

for (let index = 0; index < 500; index++) {
    str += "如果 options.withFileTypes 设置为 true，则解决的数组将包含 fs.Dirent 对象\n" ;   
}

var writeStream = fs.createWriteStream("./data/output.txt");

writeStream.write(str);

//标记结尾，结尾了才会触发 finish 事件
writeStream.end();

writeStream.on("finish",()=>{
    console.log("写入完成！");
})